package a04_字符串;

/**
 * <p>
 * a01_反转字符串
 * </p>
 *
 * @author flyduck
 * @since 2024-07-09
 */
public class a01_反转字符串复习3 {
    public void reverseString(char[] source) {
        int leftIdx = 0;
        int rightIdx = source.length - 1;
        while (leftIdx < rightIdx) {
            char temp = source[leftIdx];
            source[leftIdx] = source[rightIdx];
            source[rightIdx] = temp;
            leftIdx++;
            rightIdx--;
        }
    }
}
